﻿//Question 0:
var arr = [];
var addElement = function () {
    "use strict";
    arr.push(document.getElementById("data").value)
    document.getElementById("data").value = "";
};
var alertArray = function () {
    "use strict";
    for (var i = 0; i < arr.length; i++) {
        alert(arr[i]);
    }
};
//Question 1:
var arr1 = [];
var inputDiv = function () {
    "use strict";
    document.getElementById("divq1").innerHTML += document.getElementById("data1").value + " ";
};
//Question 2:
var arr2 = [];
var addElement2 = function () {
    "use strict";
    arr2.push(document.getElementById("data2.1").value);
};
var getIndexOf = function () {
    "use strict";
    alert(arr2[document.getElementById("data2.2").value]);
};
//Question 3:
var arr3 = []
var addElement3 = function () {
    "use strict";
    arr3.push(document.getElementById("data3.1").value);
};
//Question 4:
var arr4 = [];
var addElement4=function(){
    "use strict";
    arr4.push(document.getElementById("data4.1").value);
};
var addIndexToDiv = function () {
    "use strict";
    var x = document.getElementById("data4.2").value;
    document.getElementById("divq4").innerHTML += arr4[x] + " ";
};
//Question 5:
var arr5 = [];
var addElement5 = function () {
    "use strict";
    arr5.push(document.getElementById("data5.1").value);
};
var loopToDiv = function () {
    "use strict";
    for(var i in arr5){
        document.getElementById("divq5").innerHTML += arr5[i] + " ";
    }
};
//Question 6:
var arr6 = [];
var addElement6 = function () {
    "use strict";
    arr6.push(document.getElementById("data6.1").value);
};
var oddNumToDiv=function(){
    "use strict";
    for(var i in arr6){
        if(arr6[i]%2==1){
            document.getElementById("divq6").innerHTML += arr6[i] + " ";
        }
    }
};
//Question 7:
var arr7 = [];
var addElement7 = function () {
    "use strict";
    arr7.push(document.getElementById("data7.1").value);
};
var displayToDiv7 = function () {
    "use strict";
    for (var i in arr7) {
            document.getElementById("divq7").innerHTML += arr7[i] + " ";
    }
    document.getElementById("divq7").innerHTML += "<br/>"
};
//Question 8:
var arr8 = [];
var addElement8 = function () {
    "use strict";
    arr8.push(document.getElementById("data8.1").value);
};
var removeElement8 = function () {
    arr8.splice(document.getElementById("data8.2").value,1)
};
//Question 8:
var arr9 = [];
var addElement9 = function () {
    "use strict";
    arr9.push(document.getElementById("data9.1").value);
};
var outputArray = function () {
    "use strict";
    for (var i in arr9) {
        document.getElementById("divq9").innerHTML += arr9[i] + " ";
    }
    document.getElementById("divq9").innerHTML += "<br/>"
};
var swapper9 = function () {
    "use strict";
    document.getElementById("data9.1").value = arr9[document.getElementById("data9.2").value];
};
array1 = [1, 2, 3, 4, 5, 6, 7, 8, 9];
copyArr = [];
copyArr = array1.map(function (x) { return x });
